package etf.pia.entity;
// Generated Feb 13, 2014 1:21:45 AM by Hibernate Tools 3.6.0


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Korisnik generated by hbm2java
 */
@Entity
@Table(name="korisnik"
    ,catalog="pia"
    , uniqueConstraints = @UniqueConstraint(columnNames="korisnickoIme") 
)
public class Korisnik  implements java.io.Serializable {


     private Integer idKorisnik;
     private Role role;
     private String korisnickoIme;
     private String lozinka;
     private Zaposleni zaposleni;
     private Student student;

    public Korisnik() {
    }

	
    public Korisnik(Role role, String korisnickoIme, String lozinka) {
        this.role = role;
        this.korisnickoIme = korisnickoIme;
        this.lozinka = lozinka;
    }
    public Korisnik(Role role, String korisnickoIme, String lozinka, Zaposleni zaposleni, Student student) {
       this.role = role;
       this.korisnickoIme = korisnickoIme;
       this.lozinka = lozinka;
       this.zaposleni = zaposleni;
       this.student = student;
    }
   
     @Id @GeneratedValue(strategy=IDENTITY)

    
    @Column(name="id_korisnik", unique=true, nullable=false)
    public Integer getIdKorisnik() {
        return this.idKorisnik;
    }
    
    public void setIdKorisnik(Integer idKorisnik) {
        this.idKorisnik = idKorisnik;
    }

@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="rola", nullable=false)
    public Role getRole() {
        return this.role;
    }
    
    public void setRole(Role role) {
        this.role = role;
    }

    
    @Column(name="korisnickoIme", unique=true, nullable=false, length=45)
    public String getKorisnickoIme() {
        return this.korisnickoIme;
    }
    
    public void setKorisnickoIme(String korisnickoIme) {
        this.korisnickoIme = korisnickoIme;
    }

    
    @Column(name="lozinka", nullable=false, length=45)
    public String getLozinka() {
        return this.lozinka;
    }
    
    public void setLozinka(String lozinka) {
        this.lozinka = lozinka;
    }

@OneToOne(fetch=FetchType.LAZY, mappedBy="korisnik")
    public Zaposleni getZaposleni() {
        return this.zaposleni;
    }
    
    public void setZaposleni(Zaposleni zaposleni) {
        this.zaposleni = zaposleni;
    }

@OneToOne(fetch=FetchType.LAZY, mappedBy="korisnik")
    public Student getStudent() {
        return this.student;
    }
    
    public void setStudent(Student student) {
        this.student = student;
    }




}


